Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3222288
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T15:58:25+00:00 2026-05-17T15:58:25+00:00

In my code, I am making a http request (using cfhttp) and storing the

  • 0

In my code, I am making a http request (using cfhttp) and storing the result in a variable. The http request does return results- I know this because I am logging the time of the request and the results.

However, something is apparently going wrong sometimes with storing the results of the http request (cfhttp.filecontent) in a variable, because later, when I set another variable to the first variable, the first variable is occasionally throwing an error (“Element insurance_233 is undefined in a CFML structure referenced as part of an expression.”). When I dump out the session variable, the element is, sure enough, not there. I can’t figure out what causes the error to occur.

Here is the code (modified slightly, but in essence enough to illustrate what I’m talking about. The trim was added in in the hopes it would solve the error. Also, I subsequently changed “inurance” & #myNum# to the more syntactically correct “insurance#myNum#”, but for this illustration I left it in its original state to show how it was the last time the error was thrown.):

<cfloop query="myQuery"> <!--- one of the query columns is myNum--->
    <cflock scope="session" type="exclusive" timeout="10">
        <cfset session.report.mydata["insurance_" & #myNum#] = cfhttp.filecontent>
    </cflock>
    <cfset request.report.mydata["insurance_" & #myNum#] = trim(session.report.mydata["insurance_" & #myNum#])>
</cfloop>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T15:58:26+00:00Added an answer on May 17, 2026 at 3:58 pm

    You are not locking the logic that is responsible for setting the value of myNum. If multiple requests are being processed at the same time, you could end up with the following situation.

    Request 1: sets myNum to 33
    Request 1: writes data to session using myNum as the index; i.e. session[33]
    Request 2: sets myNum to 34 
    Request 1: reads data from session using myNum as the index; i.e. session[34]
    Request 2: writes data to session using myNum as the index; i.e. session[34]
    

    Thus, Request 1 attempts to read from an undefined location because Request 2 has incremented the index/myNum but has not written any data.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can i get the source code for a WAMP stack installer somewhere? Any help
I'm in the process of porting some code from Linux to Mac OS X.
I am using a 3rd-party rotator object, which is providing a smooth, random rotation
Has anyone got EclipseLink MOXy (I'm using eclipselink 2.1.0) to work with Java 5?
I have a project that adds elements to an AutoCad drawing. I noticed that
I would like to get a sum from a column, with and without a
(please excuse that I didn't use aliases). I would like my query output to
I'm getting an error here that says I haven't defined a method, but it
I make a distributed embedded application that will make use of several micro-controllers. The
Let say I have the following desire, to simplify the IConvertible's to allow me

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.