BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
dcortell
Pyrite | Level 9

Dear experts

 

I have a code iteratively scraping a list of URLs using the following code:

 

MPRINT(PROCHTTP_CHECK_RETURN):   filename src temp;
MPRINT(PROCHTTP_CHECK_RETURN):   proc http url="communities.sas.com/t5/forums/recentpostspage/user-id/407567" out=src;
MPRINT(PROCHTTP_CHECK_RETURN):   run;

I get during the execution the following error:

 

ERROR: Resource is write-locked by another thread.  File =/batchtmp/SAS_work2268000075CE_miseiddvp1/#LN00021.
ERROR: File is in use, /batchtmp/SAS_work2268000075CE_miseiddvp1/#LN00021.
ERROR: Resource is write-locked by another thread.  File =/batchtmp/SAS_work2268000075CE_miseiddvp1/#LN00021.
ERROR: File is in use, /batchtmp/SAS_work2268000075CE_miseiddvp1/#LN00021.
ERROR: Resource is write-locked by another thread.  File =/batchtmp/SAS_work2268000075CE_miseiddvp1/#LN00021.
ERROR: File is in use, /batchtmp/SAS_work2268000075CE_miseiddvp1/#LN00021.

There is any way I can work to ensure that the write-locking of the file do not persist?

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

Partial code is such a pain.

 

Since you are "iteratively scraping " where are you CLEARING the filename SRC assignment?

I suspect that you need a

Filename SRC CLEAR;

before attempting the subsequent "iteration". But where it may go can't tell.

View solution in original post

4 REPLIES 4
s_lassen
Meteorite | Level 14

I tried your code in SAS Studio, and did not get any errors.

 

I am not sure, but one explanation that you get this error could be that PROC HTTP tries to run several threads - if that's the case, you could try using

option nothreads;

in your macro before calling PROC HTTP.

dcortell
Pyrite | Level 9

hanks. I will try that.

 

Also, to provide more details I add the extended log, as the error is persisting:

 

As I see the error triggered on the 15/09, and there was no other version of the code running in parallel on that day, I can also exclude that the error is generated by a parallel session running. so no idea at all why this is happening.

MPRINT(PROCHTTP_CHECK_RETURN):   filename src temp;
MPRINT(PROCHTTP_CHECK_RETURN):   proc http url="vle.sas.com/mod/page/view.php?id=139728" out=src;
MPRINT(PROCHTTP_CHECK_RETURN):   run;

ERROR: Resource is write-locked by another thread.  File =/batchtmp/SAS_workB9F50001F7E4_miseiddvp1/#LN00021.
ERROR: File is in use, /batchtmp/SAS_workB9F50001F7E4_miseiddvp1/#LN00021.
ERROR: Resource is write-locked by another thread.  File =/batchtmp/SAS_workB9F50001F7E4_miseiddvp1/#LN00021.
ERROR: File is in use, /batchtmp/SAS_workB9F50001F7E4_miseiddvp1/#LN00021.
ERROR: Resource is write-locked by another thread.  File =/batchtmp/SAS_workB9F50001F7E4_miseiddvp1/#LN00021.
ERROR: File is in use, /batchtmp/SAS_workB9F50001F7E4_miseiddvp1/#LN00021.
ERROR: Resource is write-locked by another thread.  File =/batchtmp/SAS_workB9F50001F7E4_miseiddvp1/#LN00021.
ERROR: File is in use, /batchtmp/SAS_workB9F50001F7E4_miseiddvp1/#LN00021.
ERROR: Resource is write-locked by another thread.  File =/batchtmp/SAS_workB9F50001F7E4_miseiddvp1/#LN00021.
ERROR: File is in use, /batchtmp/SAS_workB9F50001F7E4_miseiddvp1/#LN00021.
ERROR: Resource is write-locked by another thread.  File =/batchtmp/SAS_workB9F50001F7E4_miseiddvp1/#LN00021.
ERROR: File is in use, /batchtmp/SAS_workB9F50001F7E4_miseiddvp1/#LN00021.
NOTE: 200 OK
ERROR: Generic HTTP Client Error
NOTE: PROCEDURE HTTP used (Total process time):
      real time           0.22 seconds
      user cpu time       0.00 seconds
      system cpu time     0.00 seconds
      memory              487.37k
      OS Memory           579068.00k
      Timestamp           09/15/2023 07:31:55 PM
      Step Count                        3758064  Switch Count  0
      Page Faults                       0
      Page Reclaims                     68
      Page Swaps                        0
      Voluntary Context Switches        13
      Involuntary Context Switches      0
      Block Input Operations            0
      Block Output Operations           0
      
NOTE: The SAS System stopped processing this step because of errors.
yabwon
Onyx | Level 15

I think it's not the "threads" option:

1    options threads;
2    filename src temp;
3    proc http url="communities.sas.com/t5/forums/recentpostspage/user-id/407567" out=src;
4    run;

NOTE: 200 OK
NOTE: PROCEDURE HTTP used (Total process time):
      real time           0.74 seconds
      cpu time            0.00 seconds

I would rather consider network issue (maybe VPN is blocking access).

 

You can try filename URL approach too:

1
2    filename src temp lrecl=1 recfm=n;;
3    filename in URL "https://communities.sas.com/t5/forums/recentpostspage/user-id/407567" lrecl=1 recfm=n;
4
5    data _null_;
6      rc = fcopy("in", "src");
7      rctxt = sysmsg();
8      if rc then put rctxt ;
9    run;

NOTE: DATA statement used (Total process time):
      real time           10.40 seconds
      cpu time            0.28 seconds

 

Bart

 

_______________
Polish SAS Users Group: www.polsug.com and communities.sas.com/polsug

"SAS Packages: the way to share" at SGF2020 Proceedings (the latest version), GitHub Repository, and YouTube Video.
Hands-on-Workshop: "Share your code with SAS Packages"
"My First SAS Package: A How-To" at SGF2021 Proceedings

SAS Ballot Ideas: one: SPF in SAS, two, and three
SAS Documentation



ballardw
Super User

Partial code is such a pain.

 

Since you are "iteratively scraping " where are you CLEARING the filename SRC assignment?

I suspect that you need a

Filename SRC CLEAR;

before attempting the subsequent "iteration". But where it may go can't tell.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 1075 views
  • 1 like
  • 4 in conversation